package com.test13.codec;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.junit.Test;

/*
 * 这是doc文档
 * http://commons.apache.org/proper/commons-codec/archives/1.10/apidocs/index.html
 * 总结：
 *    1.
 */
public class Md5Demo {
	@Test
	public void md5demo01() {
		String md5Hex = DigestUtils.md5Hex("123456");
		
		System.out.println(md5Hex);
	}
	
	@Test
	public void sha1demo02() {
		String string = DigestUtils.sha1Hex("123456");
		
		System.out.println(string);
	}
	
	/**
	 * base64的加密
	 */
	@Test
	public void base64demo03() {
		byte[] encodeBase64 = Base64.encodeBase64("123456".getBytes());
		System.out.println(new String(encodeBase64));
	}
	/**
	 * base64的解密
	 */
	@Test
	public void base64demo04() {
		byte[] encodeBase64 = Base64.decodeBase64("MTIzNDU2");
		System.out.println(new String(encodeBase64));
	}
	
	
}
